#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      sanchez
#
# Created:     19/09/2011
# Copyright:   (c) sanchez 2011
# Licence:     <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python


FILE="Batch"
actions=["Originaux","FFT","Ondelette","Filtre","tri_Phase","ITC"]
items=["Originaux","FFT","Ondelette","Filtre","Phase","ITC"]

nom_menu=FILE+"_menu"
fichier = open("test.txt", "w")

s=FILE+"_menu = self.menuBar().addMenu(\""+FILE+"\")"
print s
fichier.write("#--------------------------------------------------\n")
fichier.write("#           "+FILE+"_menu\n")
fichier.write("#--------------------------------------------------\n")

fichier.write("        "+FILE+"_menu = self.menuBar().addMenu(\""+FILE+"\")\r\n")

for i in range(len(actions)):
    s=actions[i]+"_action = create_action(self,"+"\""+items[i]+"\""+",triggered=self.on_open_"+FILE+"_"+actions[i]+")"
    print s
    fichier.write("        "+s+"\n")
fichier.write("\n")
s="add_actions("+FILE+"_menu,("
print s
fichier.write("        "+s+"\n")
for i in range(len(actions)):
    s= actions[i]+"_action,"
    print s
    fichier.write("        "+s+"\n")
print "))"
fichier.write("        "+"))\n")
fichier.write("\n")

for i in range(len(actions)):
    s="def "+ "on_open_"+FILE+"_"+actions[i]+"(self):"
    print s
    fichier.write("    "+s+"\n")
    print "    pass"
    print "    return"
    print " "
    fichier.write("    "+"    pass\n")
    fichier.write("    "+"    return\n")
    fichier.write("\n")

fichier.close()